<?php
if ( function_exists('register_sidebars') )
 register_sidebars(2,array(
        'before_widget' => '<div class="box">',
    'after_widget' => '</div>',
 'before_title' => '<div class="header"><h3>',
        'after_title' => '</h3></div>',
    ));

function widget_aoe_search() {
?>
    	<div class="box">
		    <div class="header"><h3>Search</h3></div>
            <div id="sidesearch">
			<form method="get" action="<?php bloginfo('url'); ?>/">
				<input type="text" value="" name="s" class="text" />
				<input type="submit" id="search-submit" class="button" value="Go!" />
			</form>
            </div>
            <div class="footer"></div>
		</div>
<?php
}

function widget_aoe_tag_cloud($a) {
    $options = get_option('widget_tag_cloud');    
    $title = empty($options['title']) ? __('Tags') : apply_filters('widget_title', $options['title']);
?>
	<div class="box">
	    <div class="header"><h3><?php echo $title ?></h3></div>
		<div class="tags">
			<?php wp_tag_cloud();?>
		</div>
        <div class="footer"></div>
	</div>
<?php
}
/*
<?php wp_text() ?>
*/

function widget_aoe_text($args, $widget_args = 1) {
	extract( $args, EXTR_SKIP );
	if ( is_numeric($widget_args) )
		$widget_args = array( 'number' => $widget_args );
	$widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
	extract( $widget_args, EXTR_SKIP );

	$options = get_option('widget_text');
	if ( !isset($options[$number]) )
		return;

	$title = apply_filters('widget_title', $options[$number]['title']);
	$text = apply_filters( 'widget_text', $options[$number]['text'] );
?>
        <div class="box">
		    <div class="header"><h3><?php if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?></h3></div>
			<div class="textwidget"><?php echo $text; ?></div>
            <div class="footer"></div>
		</div>
<?php
}


if ( function_exists('register_sidebar_widget') ) {
    register_sidebar_widget(__('Search'), 'widget_aoe_search');
}

if ( function_exists('register_sidebar_widget') ) {
    register_sidebar_widget(__('tag_cloud'), 'widget_aoe_tag_cloud');
}



if ( function_exists('register_sidebar_widget') ) {
    register_sidebar_widget(__('text'), 'widget_aoe_text');
}